package com.vlin;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class VlinPlatformBootstrap {

	public static void main(String[] args) {
		SpringApplicationBuilder springBuilder = new SpringApplicationBuilder(VlinPlatformBootstrap.class);

		if (args != null && args.length > 0)
			for (String arg : args)
				if (arg != null)
					springBuilder.properties(arg);

		springBuilder.run(args);
	}
	
	@Bean
	@LoadBalanced
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
}
